package com.siyao.redvip.ui.adapter;

import android.content.Context;
import android.widget.BaseAdapter;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.siyao.redvip.R;
import com.siyao.redvip.components.view.LoadingDialog;

public abstract  class CommonBaseAdapter extends BaseAdapter {
    protected Context mContext;
    private boolean isScrolling = false;
    protected DisplayImageOptions options;
    protected LoadingDialog pd;

    public CommonBaseAdapter(Context context) {
        this.mContext = context;
        options = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.ic_loading).showImageForEmptyUri(R.drawable.ic_load_faild).showImageOnFail(R.drawable.ic_load_faild).cacheInMemory(true)
                .cacheOnDisc(true).considerExifParams(true).displayer(new RoundedBitmapDisplayer(0)).build();
        pd = new LoadingDialog(mContext);
//		pd.setMessage(mContext.getString(R.string.handle_ing));
        pd.setCancelable(false);
    }

    public boolean isScrolling() {
        return isScrolling;
    }

    public void setScrolling(boolean isScrolling) {
        this.isScrolling = isScrolling;
        this.notifyDataSetChanged();
    }

    protected void showPd() {
        if (pd != null && !pd.isShowing()) {
            pd.show();
        }
    }

    protected void dismissPd() {
        if (pd != null && pd.isShowing()) {
            pd.dismiss();
        }
    }

}
